package com.example.admin.system.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author liucheng
 * @since 0.1 2021-07-31 11:58 PM
 **/
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    private final AuthTokenInterceptor authTokenInterceptor;

    public InterceptorConfig(AuthTokenInterceptor authTokenInterceptor) {
        this.authTokenInterceptor = authTokenInterceptor;
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authTokenInterceptor).excludePathPatterns("/**/login");
    }
}
